﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/>
    </ResourceDictionary.MergedDictionaries>

	<!--DockablePaneAnchorTab-->
    <Style x:Key="{x:Type ad:DockablePaneAnchorTab}" TargetType="{x:Type ad:DockablePaneAnchorTab}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}">
                    <Grid>
                        <Border 
							  Name="PART_Border" CornerRadius="0,0,3,3" BorderThickness="1"
							  BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}"
							  Background="{StaticResource ManagedContentTabItemNormalBackground}">
                            <StackPanel Orientation="Horizontal">
                                <ad:ImageEx x:Name="borderIcon" Width="16" Source="{TemplateBinding Icon}" />
								<TextBlock 
                                    Text="{TemplateBinding Title}"  
                                    Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" 
                                    Margin="4,2,2,2"/>
                            </StackPanel>
                        </Border>
                        <Border x:Name="HighlightBorder"
                                        Height="3"
                                        VerticalAlignment="Bottom"
                                        BorderThickness="0,0,0,0"
                                        CornerRadius ="0,0,3,3"
                                        BorderBrush="#FFE68B2C"
                                        Background="{StaticResource ManagedContentTabItemSelectedBorderBackround}"
                                        Visibility="Hidden"
                                        />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Anchor" >
                            <Trigger.Value>
                                <ad:AnchorStyle>
                                    Left
                                </ad:AnchorStyle>
                            </Trigger.Value>
                            <Setter TargetName="PART_Border" Property="CornerRadius" Value="3,3,0,0"/>
                            <Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/>
                            <Setter TargetName="HighlightBorder" Property="CornerRadius" Value="3,3,0,0"/>
                            <Setter Property="VerticalAlignment" Value="Top" TargetName="HighlightBorder"/>
                        </Trigger>
                        <Trigger Property="Anchor">
                            <Trigger.Value>
                                <ad:AnchorStyle>
                                    Bottom
                                </ad:AnchorStyle>
                            </Trigger.Value>
                            <Setter TargetName="PART_Border" Property="CornerRadius" Value="3,3,0,0"/>
                            <Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/>
                            <Setter TargetName="HighlightBorder" Property="CornerRadius" Value="3,3,0,0"/>
                            <Setter Property="VerticalAlignment" Value="Top" TargetName="HighlightBorder"/>
                        </Trigger>

                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Visibility" Value="Visible" TargetName="HighlightBorder"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
   
	<!--DockablePaneAnchorTabGroup-->
    <Style x:Key="{x:Type ad:DockablePaneAnchorTabGroup}" TargetType="{x:Type ad:DockablePaneAnchorTabGroup}">
        <Setter Property="Orientation" Value="Horizontal"/>
        <Setter Property="Margin" Value="3,0,0,0"/>
    </Style>
	
	<!--DockingManager-->
    <Style x:Key="{x:Type ad:DockingManager}" TargetType="{x:Type ad:DockingManager}">
		<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/>
		<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
		<Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:DockingManager}">
                    <Grid
                        Background="{TemplateBinding Background}"
                        >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <StackPanel Name="PART_LeftAnchorTabPanel" 
                                Grid.Column="0" Grid.Row="1" Orientation="Vertical">
                            <StackPanel.Resources>
                                <Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}">
                                    <Setter Property="LayoutTransform">
                                        <Setter.Value >
                                            <RotateTransform Angle="90"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Margin" Value="0,2,2,0"/>
                                </Style>
                                <Style TargetType="Border">
                                    <Setter Property="CornerRadius" Value="0,0,3,3"/>
                                </Style>
                            </StackPanel.Resources>
                        </StackPanel>
                        <StackPanel Name="PART_RightAnchorTabPanel" Grid.Column="2" Grid.Row="1"  Orientation="Vertical">
                            <StackPanel.Resources>
                                <Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}">
                                    <Setter Property="LayoutTransform">
                                        <Setter.Value >
                                            <RotateTransform Angle="90"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Margin" Value="2,2,0,0"/>
                                </Style>
                                <Style TargetType="Border">
                                    <Setter Property="CornerRadius" Value="3,3,0,0"/>
                                </Style>
                            </StackPanel.Resources>
                        </StackPanel>
                        <StackPanel Name="PART_TopAnchorTabPanel" Grid.Column="1" Grid.Row="0" Orientation="Horizontal"/>
                        <StackPanel Name="PART_BottomAnchorTabPanel" Grid.Column="1" Grid.Row="2" Orientation="Horizontal"/>
                        <Border 
                            Background="{TemplateBinding Background}"
                            Grid.Column="1" Grid.Row="1">
                            <ContentPresenter />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>